<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
var n = 20;
var sum = 0;
for (var i = 1; i <= n; i++){
    var ji = 1;
    //求的 i 的阶乘
    for (var j = i; j > 0; j--){
        ji *= j;
    }
    sum += ji;
}
console.log("1 到" + n + "的阶乘的和是:" + sum);

var m = 34895043580;
var msg = m + " = "
for (var i = 2, temp = m; i <= temp; i++){
    if (temp % i == 0){
        msg += i
        if (i != temp){
            msg += " * "
        }
        temp /= i;
        i--;
    }
}
console.log(msg)

for (var i = 1; i <= 9; i++){
    for (j = 1; j <= i; j++){
        document.write(j + " * " + i + " = " + i * j + "&nbsp;&nbsp;")
    }
    document.write("<br>")
}

var count = 6;  //表示桃子数
var ok = false //表示是否找到正确的桃子树  true 表示找到了, false 表示没有
for (; ; count++){
    var temp = count;
    for (var monkey = 1; monkey <= 5; monkey++){
        if (temp % 5 == 1){
            if (monkey == 5){
                ok = true;
                break;
            }
            temp = (temp - 1) * 0.8
        }else{
            break;
        }
    }
    if (ok) break;
}
console.log(count)
</script>
</body>
</html>